﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using SqlSugar;

namespace Aioms.Models
{
    ///<summary>
    ///用户信息表，保存用户信息。
    ///</summary>
    [SugarTable("employee")]
    public class Employee
    {
        public Employee()
        {
            this.Created = DateTime.Now;
            this.Updated = DateTime.Now;
        }
        /// <summary>
        /// Desc:主键ID
        /// Default:
        /// Nullable:False
        /// </summary>           
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "id")]
        [JsonProperty("id")]
        public long Id { get; set; }

        /// <summary>
        /// Desc:部门ID
        /// Default:
        /// Nullable:True
        /// </summary>  
        [SugarColumn(ColumnName = "dpid")]
        [JsonProperty("dpid")]
        public long Dpid { get; set; }

        /// <summary>
        /// Desc:部门ID
        /// Default:
        /// Nullable:True
        /// </summary>  
        [SugarColumn(IsIgnore = true)]
        [JsonIgnore]
        public long[] Rids { get; set; }

        /// <summary>
        /// Desc:实名
        /// Default:
        /// Nullable:True
        /// </summary> 
        [SugarColumn(ColumnName = "realname")]
        [JsonProperty("realname")]
        public string Realname { get; set; }

        /// <summary>
        /// Desc:手机电话
        /// Default:
        /// Nullable:True
        /// </summary>  
        [SugarColumn(ColumnName = "mobile")]
        [JsonProperty("mobile")]
        public string Mobile { get; set; }

        /// <summary>
        /// Desc:密码
        /// Default:
        /// Nullable:True
        /// </summary>     
        [SugarColumn(ColumnName = "password")]
        [JsonProperty("password")]
        public string Password { get; set; } = "";

        /// <summary>
        /// Desc:加密串
        /// Default:
        /// Nullable:True
        /// </summary>  
        [SugarColumn(ColumnName = "token")]
        [JsonProperty("token")]
        public string Token { get; set; }

        /// <summary>
        /// Desc:性别
        /// Default:
        /// Nullable:True
        /// </summary>   
        [SugarColumn(ColumnName = "gender")]
        [JsonProperty("gender")]
        public string Gender { get; set; }

        /// <summary>
        /// Desc:头像
        /// Default:
        /// Nullable:True
        /// </summary>   
        [SugarColumn(ColumnName = "avatar")]
        [JsonProperty("avatar")]
        public string Avatar { get; set; }

        /// <summary>
        /// Desc:备注
        /// Default:
        /// Nullable:True
        /// </summary>   
        [SugarColumn(ColumnName = "remark")]
        [JsonProperty("remark")]
        public string Remark { get; set; }

        /// <summary>
        /// Desc:状态
        /// Default:
        /// Nullable:True
        /// </summary>   
        [SugarColumn(ColumnName = "status")]
        [JsonProperty("status")]
        public string Status { get; set; }

        /// <summary>
        /// Desc:上次登录企业默认id
        /// Default:
        /// Nullable:True
        /// </summary>        
        [SugarColumn(ColumnName = "default_eid")]
        [JsonProperty("default_eid")]
        public long DefaultEid { get; set; }

        /// <summary>
        /// Desc:登录错误次数
        /// Default:0
        /// Nullable:True
        /// </summary>    
        [SugarColumn(ColumnName = "login_error_count")]
        [JsonProperty("login_error_count")]
        public int LoginErrorCount { get; set; }

        /// <summary>
        /// Desc:最后的登录时间
        /// Default:
        /// Nullable:True
        /// </summary>   
        [SugarColumn(ColumnName = "logged")]
        [JsonProperty("logged")]
        public DateTime Logged { get; set; }

        /// <summary>
        /// Desc:入职时间
        /// Default:
        /// Nullable:True
        /// </summary>          
        [SugarColumn(ColumnName = "activated")]
        [JsonProperty("activated")]
        public DateTime Activated { get; set; }

        /// <summary>
        /// 软删除标记：1.删除 0.未删除
        /// </summary>           
        [SugarColumn(ColumnName = "isdel")]
        [JsonProperty("isdel")]
        public int IsDel { get; set; } = 0;

        /// <summary>
        /// Desc:创建日期
        /// Default:
        /// Nullable:True
        /// </summary>         
        [SugarColumn(ColumnName = "created")]
        [JsonProperty("created")]
        public DateTime? Created { get; set; }

        /// <summary>
        /// Desc:更新日期
        /// Default:
        /// Nullable:True
        /// </summary>         
        [SugarColumn(ColumnName = "updated")]
        [JsonProperty("updated")]
        public DateTime? Updated { get; set; }

        /// <summary>
        /// 角色列表
        /// </summary>  
        [SugarColumn(IsIgnore = true)]
        [JsonProperty("department")]
        public Department Department { get; set; }

        /// <summary>
        /// 角色列表
        /// </summary>  
        [SugarColumn(IsIgnore = true)]
        [JsonProperty("roles")]
        public List<Role> Roles { get; set; }
    }
}
